import request from '@/utils/request'



export interface SubCategoriesModel {
    id: number
    name: string
    displayName: string
    metadataValues?: SubCategoriesModel[]
    materialType?: string
    metadatas?: []
}
export interface CategoryListModel {
    id: number
    name: string
    title: string
    categoryType: number
    orderNum: number
    parentId: number
    isDisplay: boolean
    subCategories: SubCategoriesModel[]
}


export interface AlbumsModel {
    albumId: number
    albumPlayCount: number
    albumTrackCount: number
    albumCoverPath: string
    albumTitle: string
    albumUserNickName: string
    anchorId: number
    anchorGrade: number
    mvpGrade: number
    isDeleted: boolean
    isPaid: boolean
    isFinished: number
    anchorUrl: string
    albumUrl: string
    intro: string
    vipType: number
    logoType: number
    subscriptInfo: {albumSubscriptValue:number,url: string},
    albumSubscript: number
}
export interface SortModel {
    currentUid: number,
    total: number,
    pageNum: number,
    pageSize: number,
    albums: AlbumsModel[]
}


export default {
    getCategoryList() {
        return request.get<any, CategoryListModel[]>('/m-revision/page/category/queryCategoriesV2')
    },
    getCategoryTwoList(categoryId: string) {
        return request.get<any, { metadata: SubCategoriesModel[] }>(`/revision/category/v2/metadata/info?categoryId=${categoryId}`)
    },
    getsortList(pageNum: number, pageSize: number, sort: number, categoryId: number, metadataValues: string) {
        return request.get<any,SortModel>(`/revision/category/v2/albums?pageNum=${pageNum}&pageSize=${pageSize}&sort=${sort}&categoryId=${categoryId}&metadataValues=${metadataValues}`)
    }
}